<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/page/share/taglib.jsp"%>
<html>
	<head>
		<title>人员信息修改</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="/css/modules.css" type="text/css"
			media="screen" />
		<link rel="stylesheet" href="/css/modules1.css" type="text/css"
			media="screen" />
		<style type="text/css">
			label{
				display:inline;
			}
		</style>	
		<script type="text/javascript" src="/js/jquery-1.4.2.min.js" ></script>
		<script language="JavaScript">
		function loadCity(f){
			var provinceid=$(f).val();
			$("#cityspan").load("/area/province!getCity.action?provinceid='"+provinceid+"'");
			$("#regionspan").html("");
			$(f).attr("name","province.id");
		//	$("#psel").attr("name","ff.dd");
		}
		
		function loadRegion(f){
			var cityid=$(f).val();
			$("#regionspan").load("/area/province!getRegion.action?cityid='"+cityid+"'");
			$("#psel").attr("name","");
			$(f).attr("name","province.id");
		//	$("#csel").attr("name","");
		}

		function zz(f){
			
			$("#csel").attr("name","");
			$(f).attr("name","province.id");
		//	$("#csel").attr("name","");
		}



function validateUsernameExsit(username){
	if(username.trim()!=""){
		var usernameview = document.getElementById('usernameview');		
		if(usernameview){
			send_request(function(value){usernameview.innerHTML=value},
					 '<s:url action="UserManage!exist"/>?username='+ username, true);
		}
	}
}

function Formfield(name, label){
	this.name=name;
	this.label=label;
}
function checkfm(form){
	var list  = new Array(new Formfield("username", "登录账号"),
				new Formfield("realname", "真实姓名"),new Formfield("idCard", "身份证号码"),
				new Formfield("degree","学历"),new Formfield("school","毕业院校"),
				new Formfield("postalcode","邮编"),new Formfield("phone", "联系电话"),
				new Formfield("email","电子邮件"));
	for(var i=0;i<list.length;i++){
		var objfield = eval("form."+ list[i].name);
		if(trim(objfield.value)==""){
			alert(list[i].label+ "不能为空");
			if(objfield.type!="hidden" && objfield.focus()) objfield.focus();
			return false;
		}
	}
	if(form.username.value.length<6){
		alert("登录账号的长度应大于或等于6位");
		return false;
	}	
	if(form.idCard.value.length!=15 && form.idCard.value.length!=18){
		alert("身份证号码的长度应该是15位或者18位");
		return false;
	}
	if(form.role.value=="权限选择"){
			alert("请选择权限");
		return false;
	}

	
	return true;
}
</script>
	</head>
	<body style="background-color:transparent">
	<h2 class="jquery_tab_title">修改人员</h2>
	<div style="padding-top:20px;">
		<s:form action="UserManage!updateUser" method="post" onsubmit="return checkfm(this)" >

			<s:hidden name="userid"></s:hidden>
			<table id="noborder_table" width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td><label>手机号码:<span style="color:red">*</span></label></td>
					<td><s:textfield name="phone" cssClass="input-small" size="20" maxlength="11" theme="simple"></s:textfield></td>
				</tr>
				<tr>
					<td><label>真实姓名:<span style="color:red">*</span></label></td>
					<td><s:textfield name="realname" cssClass="input-small" size="10" maxlength="10" theme="simple"></s:textfield></td>
				</tr>
				<s:hidden name="password"></s:hidden>
				<tr>
					<td><label>性别:</label></td>
					<td>
					<s:radio list="%{#{'MAN':'男','WOMAN':'女'}}" name="gender" theme="simple"></s:radio>
					</td>
				</tr>
				<tr>
					<td><label>部门:<span style="color:red">*</span></label></td>
					<td>
					<s:select name="departmentid" list="%{departmentList}" listKey="id" listValue="name" headerKey="%{department.id}" headerValue="%{department.name}" theme="simple"></s:select>
					</td>
				</tr>
				<tr>
					<td><label>管理区域:<span style="color:red">*</span></label></td>
					<td>
				
					<span id="provincespan">
						<s:if test="provinces.size>0">
							<s:iterator value="provinces">
								
							<s:select id="psel" name="province.id" list="%{provinceList}" listKey="id" listValue="name" headerKey="%{id}" headerValue="%{name}" theme="simple" onclick="loadCity(this)" ></s:select>
						
								</s:iterator>
						</s:if>
						<s:else>
						<s:select id="psel" list="%{provinceList}" listKey="id" listValue="name" headerKey="0" headerValue="请选择" theme="simple" onclick="loadCity(this)" ></s:select>
						</s:else>		
						</span>
						<span id="cityspan">
						</span>
						<span id="regionspan">
						</span>
				
					</td>
				</tr>
				
				<tr>
					<td><label>电子邮件:</label></td>
					<td><s:textfield name="email" cssClass="input-medium" size="20" maxlength="2" theme="simple"></s:textfield></td>
				</tr>
				<tr>
				 	<td><label>选择角色:</label></td>
				 	<td>
				 	<s:if test="#session.user.role.name=='系统管理员'">
				 	<s:radio list="#{'GEN_MANAGER':'总经理','PDOM':'销售总监','MSM':'销售经理','PTWK':'库管','CLDSSM':'店长','ADMIN':'系统管理员'}"
					name="role" theme="simple" listKey="key" listValue="value"></s:radio>
					</s:if>
					<s:if test="#session.user.role.name=='总经理'">
				 	<s:radio list="%{#{'GEN_MANAGER':'总经理','PDOM':'销售总监','MSM':'销售经理','PTWK':'库管','CLDSSM':'店长','ADMIN':'系统管理员'}}"
					name="role" theme="simple" ></s:radio>
					</s:if>
					<s:if test="#session.user.role.name=='库管'">
				 	<s:radio list="%{#{'PTWK':'库管'}}"	name="role" theme="simple" ></s:radio>
					</s:if>
					<s:if test="#session.user.role.name=='店长'">
				 	<s:radio list="%{#{'CLDSSM':'店长'}}" name="role" theme="simple" ></s:radio>
					</s:if>
					
					</td>
				</tr>	
				<tr>
					<td></td>
					<td>
						<input type="submit" name="SYS_SET" value=" 保 存  " class="button" />
					</td>
				</tr>
			</table>
		</s:form>
		</div>
		<br>
	</body>
</html>